//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.PlugIns.Histories {
    /// <summary>An implementation of <see cref="Eas.WebCrawler.Interfaces.CompletedRequestHistory"/> which never stores a history of completed requests.</summary>
    /// <remarks>If you do not want interference between two runs of the engine, than this is the class for you.
    /// Its <see cref="GetCompletedRequests"/> member always returns an enumeration with no Uris in it, so the running the same run twice will result in all the requests being browsed twice.</remarks>
    public class AlwaysEmptyRequestHistory :Eas.WebCrawler.Common.BaseDisposable, Eas.WebCrawler.Interfaces.CompletedRequestHistory{
        /// <summary>Disposes of this object.</summary>
        /// <param name="isDisposing">Whether we are disposing or finalizing.</param>
        protected override void Dispose(bool isDisposing) {
            base.Dispose(isDisposing);
        }

        #region CompletedRequestHistory Members

        /// <summary>Returns an empty enumeration, telling the crawler that no previously-completed requests should be ignored.</summary>
        /// <returns>An empty enumeration.</returns>
        public IEnumerable<Uri> GetCompletedRequests() {
            yield break;
        }

        /// <summary>This implementation is empty (does nothing).</summary>
        /// <param name="uri">The uri which has just succesfully been processed.</param>
        public void AddCompletedRequest(Uri uri) {}
        #endregion

        #region WebCrawlerComponent Members
        /// <summary>Initializes this class</summary>
        /// <param name="context">The <see cref="Eas.WebCrawler.Interfaces.WebCrawlerContext"/> which will contain data about this instance of the web crawler.</param>
        public void Initialize(Eas.WebCrawler.Interfaces.WebCrawlerContext context) { }
        #endregion
    }
}
